package rabbit.flt.rpc.server;

import java.nio.channels.SelectionKey;

public class RequestContext {

    private static RequestContext inst = new RequestContext();

    private ThreadLocal<SelectionKey> keyContext = new ThreadLocal<>();

    private RequestContext() {
    }

    public static void setCurrentSelectionKey(SelectionKey key) {
        inst.keyContext.set(key);
    }

    public static SelectionKey getCurrentSelectionKey() {
        return inst.keyContext.get();
    }

    public static void clear() {
        inst.keyContext.remove();
    }
}
